import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

export default defineConfig({
  plugins: [vue()],
  base: './',	//不加打包后白屏
  server: {
    // host: '0.0.0.0',
    host: 'localhost',
    // cors: true,
    open:true,
    // 跨域配置
    proxy: {
      '/api': {
        target: 'http://localhost:8088',  // 后台接口地址
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, ''),
      }
    }
  },

  resolve:{
    //别名配置，引用src路径下的东西可以通过@如：import Layout from '@/layout/Index.vue'
    alias:[
      {
        find:'@',
        replacement:resolve(__dirname,'src')
      }
    ]
  }
})
